//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#include <string.h>
#include <elatypes.h>

EXTERN_C wchar_t * CDECL wcscpy(wchar_t * dest, const wchar_t * source)
{
#ifdef _GNUC

#if defined(_x86)
    int temp0, temp1, temp2;
    ASM("1:"
        "lodsw;"
        "stosw;"
        "testw %%ax, %%ax;"
        "jne 1b;"
        :"=D" (temp0), "=S" (temp1), "=a" (temp2)
        :"0" (dest), "1" (source)
        :"memory");
    return dest;
#endif    //if defined(_x86)

#endif    //ifdef _GNUC

    register size_t i = 0;
    while (source[i]) {dest[i] = source[i]; i++;}
    dest[i] = 0;
    return dest;
}
